<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:Ink="clr-namespace:SmartBoard.Ink" 
    xmlns:Model="clr-namespace:SmartBoard.Book.Model" 
    xmlns:BoardElement1="clr-namespace:SmartBoard.BackGround.BoardElement;assembly=SmartBoard.Background" 
    xmlns:Converters1="clr-namespace:SmartBoard.Converters;assembly=SmartBoard.Core" 
    xmlns:Chat="clr-namespace:SmartBoard.Chat;assembly=SmartBoard.Chat" 
    x:Class="SmartBoard.Window1"
    Title="SmartBoard" Background="#FF454C59" Foreground="#FFFCDC97" WindowStartupLocation="CenterScreen" mc:Ignorable="d">
    <Grid x:Name="LayoutRoot">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="0.511*"/>
    		<RowDefinition Height="0.489*"/>
    	</Grid.RowDefinitions>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="0.453*"/>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="0.505*"/>
    	</Grid.ColumnDefinitions>
      
    	<GridSplitter HorizontalAlignment="Center" Margin="0" Grid.Column="1" Width="2" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Center" Background="#FF262B34" Foreground="{x:Null}" Grid.RowSpan="2"/>
    	<Grid Grid.Column="2" Margin="1" Grid.RowSpan="2">
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="Auto" />
    			<ColumnDefinition Width="*" />
    			<ColumnDefinition Width="Auto" />
    		</Grid.ColumnDefinitions>
    		<Grid.RowDefinitions>
    			<RowDefinition Height="Auto"/>
    			<RowDefinition Height="*"/>
    			<RowDefinition Height="Auto"/>
    		</Grid.RowDefinitions>
        <Button Grid.Row="1" Grid.Column="0" Content="L" />
        <Button Grid.Row="1" Grid.Column="2" Content="R" />
        <StatusBar Grid.Row="2" Grid.ColumnSpan="3" Height="20">
          
        </StatusBar>
        <ToolBarTray Margin="0" Grid.ColumnSpan="3">
        	<ToolBar HorizontalAlignment="Left" Margin="0,0,0,1">
            <ToolBar.Resources>
              <Converters1:BoolToContentConverter x:Key="lockValueToImageConverter">
                <Converters1:BoolToContentConverter.TrueValueContent>
                  <Image Source="Resources/lock.png" Width="16" Height="16" />
                </Converters1:BoolToContentConverter.TrueValueContent>
                <Converters1:BoolToContentConverter.FalseValueContent>
                  <Image Source="Resources/lock_open.png" Width="16" Height="16" />
                </Converters1:BoolToContentConverter.FalseValueContent>
              </Converters1:BoolToContentConverter>
            </ToolBar.Resources>
            
        		<ToolBar.Background>
        			<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
        				<GradientStop Color="#FFFAF9F5" Offset="0"/>
        				<GradientStop Color="#FFEBE7E0" Offset="0.5"/>
        				<GradientStop Color="#FFC0C0A8" Offset="0.9"/>
        				<GradientStop Color="#FF454C59" Offset="1"/>
        			</LinearGradientBrush>
        		</ToolBar.Background>
            <Menu x:Name="componentsMenu">
              <MenuItem Header="File">
                <MenuItem Command="Model:BookCommands.New" />
                <MenuItem Click="HandleCreateClientConnection" Header="Connect" />
                <MenuItem Click ="HandleBackgroundElementColorChanged" Header="Change Background Color" />
              </MenuItem>
            </Menu>
        		<!--<Button HorizontalAlignment="Stretch" VerticalAlignment="Top" ToolTip="Create New Book..." Command="ApplicationCommands.New"  >
        			<Image Width="16" Height="16" Source="Resources/document.png" Stretch="Fill"/>
        		</Button>
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ToolTip="Open book...">
        			<Image Width="16" Height="16" Source="Resources/folder_document.png" Stretch="Fill"/>
        		</Button>
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ToolTip="Save...">
        			<Image Width="16" Height="16" Source="Resources/disk_blue.png" Stretch="Fill"/>
        		</Button>-->
            <Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="ApplicationCommands.SelectAll">
              <Image Width="16" Height="16" Source="Resources/selection_view.png" Stretch="Fill"/>
            </Button>
            <Button Command="Ink:InkRendererCommands.SelectEditingMode"
                    CommandParameter="{x:Static InkCanvasEditingMode.Select}"
                    >
              <Image Width="16" Height="16" Source="Resources/selection.png" Stretch="Fill"/>
            </Button>

            <Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="ApplicationCommands.Cut">
        			<Image Width="16" Height="16" Source="Resources/cut.png" Stretch="Fill"/>
        		</Button>
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="ApplicationCommands.Copy">
        			<Image Width="16" Height="16" Source="Resources/copy.png" Stretch="Fill"/>
        		</Button>
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="ApplicationCommands.Paste">
        			<Image Width="16" Height="16" Source="Resources/paste.png" Stretch="Fill"/>
        		</Button>
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="ApplicationCommands.Delete">
        			<Image Width="16" Height="16" Source="Resources/selection_delete.png" Stretch="Fill"/>
        		</Button>
        		
        		<ToggleButton IsThreeState="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                          Command="Ink:InkRendererCommands.Lock" 
                          CommandParameter="{Binding RelativeSource={RelativeSource Self},Path=IsChecked}"
                          Content="{Binding RelativeSource={RelativeSource Self},Path=IsChecked,Converter={StaticResource lockValueToImageConverter}}"
                          />
        		<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Command="Ink:InkRendererCommands.SelectPen">
        			<Image Width="16" Height="16" Source="Resources/pens.png" Stretch="Fill"/>
        		</Button>
        		<Button Command="Ink:InkRendererCommands.SelectEditingMode"
                    CommandParameter="{x:Static InkCanvasEditingMode.Ink}"
                    >
        			<Image Width="16" Height="16" Source="Resources/pda_write.png" Stretch="Fill"/>
        		</Button>
        		<Button Command="Ink:InkRendererCommands.SelectEditingMode"
                    CommandParameter="{x:Static InkCanvasEditingMode.EraseByStroke}"
                    >
        			<Image Width="16" Height="16" Source="Resources/EraserToolIcon.png" Stretch="Fill"/>
        		</Button>
            <CheckBox IsChecked="{Binding ElementName=inkrenderer,Path=IsActive}" Content="MakeActive" />
        	</ToolBar>
        </ToolBarTray>
        <Border BorderBrush="#FF9DA0A7" BorderThickness="5" Margin="0" Grid.Row="1" Grid.Column="1">
        	<Grid Margin="0">
        		<Ink:InkRenderer x:Name="inkrenderer" ScrollViewer.HorizontalScrollBarVisibility="Auto" Margin="1" Panel.ZIndex="1" Background="{x:Null}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" Cursor="None"/>
            <BoardElement1:BackGroundBoardElement x:Name="background" Margin="0"/>
        	</Grid>
        </Border>
    	</Grid>
      
    	<Grid Grid.Row="1" Margin="5">
        <Chat:ChatUI Grid.Row="0" Grid.Column="0"/>
        <!--<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="0.399*"/>
    			<ColumnDefinition Width="0.601*"/>
    		</Grid.ColumnDefinitions>
    		<Grid.RowDefinitions>
    			<RowDefinition Height="0.864*"/>
    			<RowDefinition Height="0.136*"/>
    		</Grid.RowDefinitions>
    		<Button Margin="0" Content="Video" Grid.Column="1"/>
    		<Button Margin="0" Content="Audio" Grid.Column="1" Grid.Row="1"/>
    		<ListBox Margin="1" Grid.RowSpan="2"/>-->
    	</Grid>

      <StackPanel Grid.Row="0">
        <TextBox x:Name="txtBox" VerticalAlignment="Stretch" Height="100" />
        <Button Content="Connect"  Click="HandleConnect" />
        <Button Content="Disconnect" Click="HandleDisconnect" />
        <Button Content="CreateClient" Click="HandleCreateClient" />
      </StackPanel>
    </Grid>
</Window>
